define(function(require, exports, module) {

  var common = require('common'),
      lang = require('lang');

  var View = require('main/admin/core/Form').extend({
    template: require('main/admin/todos/view/form.handlebars'),
    prepareViewData: function() {
      this.viewData = {
        model: this.model.toJSON(),
        label: common.todo.label,
        placeholder: common.todo.placeholder,
        select: {
          country: common.todo.country(),
          category: common.todo.category(),
          priority: common.todo.priority()
        }
      };
    },
    afterRender: function() {
      var that = this;
      this.$el.find('#daterange-plan').daterangepicker(common.format.daterangepicker, function(start, end) {
        that.$el.find('#start').val(start.format(common.format.daterangepicker.format));
        that.$el.find('#end').val(end.format(common.format.daterangepicker.format));
      });
    },
    prepareSubmitData: function() {
      var data = $(this.el).serializeJSON();
      this.submitData = {
        itsm: data.itsm,
        title: data.title,
        detail: data.detail,
        start: data.start,
        end: data.end,
        hours: data.hours,
        priority: data.priority,
        country: data.country,
        category: data.category
      };
    }
  });

  module.exports = function(options) {
    return ( new View(options) );
  }
});